<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<style>
  .bar {
    display: flex;
    width: 700px;
    height: 300px;
    margin: 50px auto;
    justify-content: space-around;
    align-items: flex-end;
    text-align: center;
    border-left: #0d0d0d solid 1px;
    border-bottom: 1px solid #0d0d0d;
  }

  .bar .bar-item {
    display: flex;
    width: 50px;
    background-color: pink;
    flex-direction: column;
    justify-content: space-between;
  }

  .bar .bar-item span {
    margin-top: -20px;
  }

  .bar .bar-item h4 {
    margin-bottom: -35px;
    width: 70px;
    margin-left: -10px;
  }
</style>

<body>


</body>
<script>
  //柱状图渲染123
  let arr = []
  for (let i = 1; i <= 4; i++) {
    arr.push(prompt("请输入第" + i + "季度销售额："))
  }
  console.log(arr)
  document.write("<div class='bar'>")
  for (let i = 0; i < arr.length; i++) {
    document.write(`<div class='bar-item' style="height:${arr[i]}px";><span>${arr[i]}</span><h4>第${i + 1}季度</h4></div>`)
  }

  document.write("</div>")

</script>

</html>